import { InputQuestion, QuestionBase, TimeQuestion } from '@/components/public-template';
import { TextTable } from '@/components/public-template';
import { TableBase } from '@/components/public-template';

class HomeService {
  getQuestions() {
    const questions: QuestionBase<any>[] = [
      new InputQuestion({
        key: 'input1',
        label: '档案编码',
        value: null,
        type: 'text'
      }),
      new InputQuestion({
        key: 'input2',
        label: '文件名称',
        value: null,
        type: 'text'
      }),
      new InputQuestion({
        key: 'input3',
        label: '文件编码',
        value: null,
        type: 'text'
      }),
      new TimeQuestion({
        key: 'startTime',
        label: '创建时间',
        value: ['2022-08-31 11:36:34', '2022-09-30 11:36:34'],
        type: 'text',
        state: {
          keySplit: ['startTime', 'endTime']
          //   type:'alone',
          //   disabledDate:(current:any)=>{
          //     return current && current < dayjs().endOf('day');
          //   },
        }
      }),
      new TimeQuestion({
        key: 'startTime',
        label: '修改时间',
        value: ['2022-08-31 11:36:34', '2022-09-30 11:36:34'],
        type: 'text',
        state: {
          keySplit: ['startTime', 'endTime']
        }
      })
    ];
    return questions;
  }
  getTables() {
    const tables: TableBase<any>[] = [
      new TextTable({
        key: 'tIndex',
        value: '序号',
        type: 'slot',
        state: {
          slotName: 'tIndex'
        }
      }),
      new TextTable({
        key: 'name1',
        value: '档案编码'
      }),
      new TextTable({
        key: 'name2',
        value: '文件名称'
      }),

      new TextTable({
        key: 'name3',
        value: '文件编码'
      }),
      new TextTable({
        key: 'name4',
        value: '档案类型'
      }),
      new TextTable({
        key: 'name5',
        value: '保管期限'
        // type: 'time',
      }),
      new TextTable({
        key: 'name6',
        value: '创建人'
      }),
      new TextTable({
        key: 'name7',
        value: '修改人'
      }),
      new TextTable({
        key: 'name8',
        value: '修改时间'
        // type: 'time',
      }),
      new TextTable({
        key: 'actions',
        value: '操作',
        columns: {
          fixed: 'right',
          width: 120
        },
        handle: [
          {
            type: 'delete',
            url: 'Course/Delete',
            text: '预览详细日志',
            class: 'text-primary',
            params: [{ id: 'id' }],
            state: {
              key: ''
            }
          }
        ]
      })
    ];
    return tables;
  }
}

export default new HomeService();
